package com.tbdp.lsmp.main;

import com.tbdp.lsmp.job.JobScheduler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author xbkaishui
 * @version $Id: Starter.java, v 0.1 2017-11-05 下午10:43 xbkaishui Exp $$
 */
public class Starter {

    public static Logger logger = LoggerFactory.getLogger(Starter.class);

    /**
     * 定时调度程序,使用quartz调度job执行
     * @param args
     */
    public static void main(String[] args) {

        JobScheduler jobScheduler = new JobScheduler();

        jobScheduler.init();

        jobScheduler.start();

        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            logger.warn(" stop jvm ");
            jobScheduler.stop();
        }));

        try {
            Thread.currentThread().join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
